home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / misc / ImageFXDevKit.lha / sdev / include / scan / buf.h next >
Encoding:
C/C++ Source or Header  |  1993-09-22  |  10.7 KB  |  308 lines

  1. /*
  2.  * Scan 'C' Header File
  3.  * Written by Thomas Krehbiel
  4.  *
  5.  * Buffers and related structures.
  6.  *
  7.  */
  8.  
  9. #ifndef SCAN_BUF_H
  10.  
  11.  
  12. #ifndef EXEC_TYPES_H
  13. #include <exec/types.h>
  14. #endif
  15.  
  16. #ifndef EXEC_NODES_H
  17. #include <exec/nodes.h>
  18. #endif
  19.  
  20. #ifndef SCAN_DRAW_H
  21. #include <scan/draw.h>     /* for enum Region_Tag */
  22. #endif
  23.  
  24. /*
  25.  * Directional masks for BuildFeatherMask() (OBSOLETE):
  26.  */
  27. #define DIR_UP       0x01
  28. #define DIR_DOWN     0x02
  29. #define DIR_LEFT     0x04
  30. #define DIR_RIGHT    0x08
  31.  
  32.  
  33. /*
  34.  * Mask - Used for defining a 1-bitplane mask plane for regions.
  35.  */
  36. struct Mask {
  37.    short             OffsetX;
  38.    short             OffsetY;
  39.    short             Width;         /* Width of rectangle */
  40.    short             Height;        /* Height of rectangle */
  41.    long              Size;          /* Size of mask data in bytes */
  42.    short             BytesPerRow;   /* Bytes per mask row */
  43.    UBYTE            *Mask;          /* Pointer to mask data (can be CHIP mem) */
  44.    enum Area_Tag     Type;          /* Type of mask */
  45.    UWORD             Reserved[7];   /* Reserved for future expansion */
  46. };
  47.  
  48. /*
  49.  * Blend - used to define a blend plane (for feathered edges and such).
  50.  *         Returned by the CreateBlend() function.
  51.  */
  52.  
  53. struct Blend {
  54.    short             Width, Height;    /* Dimensions in pixels */
  55.    ULONG             Size;             /* Size of plane in bytes */
  56.    UBYTE            *Blend;            /* Pointer to 8-bit blend data */
  57.    ULONG             Reserved[8];      /* Reserved for future expansion */
  58. };
  59.  
  60. /*
  61.  * Clip - used to save a portion of the displayed (after-render)
  62.  *        preview screen, so we can quickly restore it to the
  63.  *        screen without having to re-render.  Used internally.
  64.  */
  65.  
  66. struct Clip {
  67.    short          LeftEdge,            /* Left Corner in screen pixels */
  68.                   TopEdge;             /* Top Corner in screen pixels */
  69.    short          Width,               /* Clip width in screen pixels */
  70.                   Height;              /* Clip height in screen pixels */
  71.    short          OffsetX,             /* Attributes of the view that */
  72.                   OffsetY;             /*  the clip came from for */
  73.    short          ViewX,               /*  comparison later */
  74.                   ViewY;
  75.    struct BitMap  BitMap_old;          /* BitMap */
  76.    UBYTE         *Stencil;             /* Stencil plane */
  77.    ULONG          StencilSize;         /* Size of the stencil plane */
  78.    APTR           PreviewPtr;          /* Used only by the preview module */
  79.    struct BitMap  SwapBM_old;          /* Swap area for brushes. */
  80.    short          SwapLE, SwapTE,      /* Where swap came from. */
  81.                   SwapW, SwapH;
  82.    struct BitMap *NewBM, *NewSwapBM;
  83.    ULONG          Reserved[6];
  84. };
  85.  
  86. /*
  87.  * Buffer - Defines an 8-bit or 24-bit image buffer.  Also used
  88.  *          to define a Brush.  This structure should only be
  89.  *          obtained via. the AllocBuffer() routine.
  90.  */
  91. struct Buffer {
  92.    struct Node       Node;             /* Exec Node - unused for now */
  93.  
  94.    char              Name[130];        /* Filename of this buffer */
  95.    char              Type[16];         /* Filetype for status display */
  96.    char              Locked;           /* (unused) */
  97.    unsigned char     Flags;            /* Various flag bits (see below) */
  98.    short             Width, Height;    /* PIXEL width and height */
  99.    char              BitsPerPlane;     /* Number of bits per pixel = 8 */
  100.    char              Depth;            /* Number of planes (1 or 3) */
  101.    short             BytesPerRow;      /* Number of bytes per row */
  102.    long              PlaneSize;        /* Size of each plane */
  103.    UBYTE            *Planes[8];        /* Pointers to the planes */
  104.  
  105.    UBYTE            *Red, *Grn, *Blu;  /* Temp line pointers */
  106.    ULONG             TempSize;         /* Size of temp line buffers */
  107.  
  108.    /*
  109.     * These are used for disk buffers, and should not be modified.
  110.     */
  111.    struct VM_Handle *DHandle;          /* VMem handle */
  112.    short             LastGet;          /* Row/column of last GetBufLine() */
  113.    /* Unfortunately, this is not long aligned anymore */
  114.  
  115.    /*
  116.     * For Brushes, this defines the area of the brush.
  117.     * For Buffers, this defines what area to affect with processes.
  118.     */
  119.    struct Mask      *Mask;             /* Region mask */
  120.  
  121.    /*
  122.     * These are used mostly for Brushes.  Contains the rendered version
  123.     * of the brush for display.  Do not touch.
  124.     */
  125.    struct Clip      *Clip;             /* Fast display clip */
  126.  
  127.    /*
  128.     * These are used for mapping the buffer onto the preview display.
  129.     * They maintain the "viewport" of the buffer.  Do not touch.
  130.     */
  131.    short             OffsetX,          /* Pan position */
  132.                      OffsetY;
  133.    short             ViewX,            /* Virtual (zoomed) screen size */
  134.                      ViewY;
  135.  
  136.    /*
  137.     * Some stuff for reading multiple lines from a buffer at
  138.     * once into contiguous lines.  Do not touch.
  139.     */
  140.    UBYTE            *DLines[3];        /* Temp line pointers */
  141.    UWORD             DLineOffset;      /* Start line */
  142.    UWORD             DLineCount;       /* Number of temp lines allocated */
  143.    ULONG             DSize;            /* Bytes in each allocated line */
  144.  
  145.    /*
  146.     * See aspect discussion below.
  147.     */
  148.    short             AspectX,          /* (OBSOLETE) */
  149.                      AspectY;          /* (OBSOLETE) */
  150.  
  151.    /*
  152.     * The "handle" for a brush.  The upper-left corner is found by
  153.     * subtracting these numbers from the mouse position.  Thus if
  154.     * the handle is in the upper-left, HandleX = HandleY = 0.
  155.     */
  156.    short             HandleX,          /* X & Y handle for brushes. */
  157.                      HandleY;
  158.  
  159.    /*
  160.     * Dots per inch in the horizontal and vertical directions.  Used
  161.     * for storing in a DPI chunk and for possible printing applications.
  162.     * These can be converted to other system (eg. metric) fairly easily.
  163.     */
  164.    short             DPIX,
  165.                      DPIY;
  166.  
  167.    /*
  168.     * The pixel aspect ratio is different from the screen aspect
  169.     * ratio!  PIXEL aspect ratio defines how square the pixels are,
  170.     * the SCREEN aspect ratio defines how square the screen is.
  171.     * On a Macintosh, the pixel aspect is always 1:1 (so I'm told),
  172.     * whereas on the Amiga the pixel aspect ratios change from
  173.     * mode to mode (lores = 10:11, hires = 5:11, lores+lace = 20:11,
  174.     * hires+lace = 10:11).
  175.     */
  176.    short             PixAspectX,       /* PIXEL aspect ratio for this */
  177.                      PixAspectY;       /*  image buffer. */
  178.  
  179.    /*
  180.     * Scale tables used for displaying on the preview screen.
  181.     * Each buffer has its own scaling table attached to it.  Thus
  182.     * we should be able to handle a brush bigger than the buffer
  183.     * it is being displayed over.  Do not touch.
  184.     */
  185.    short            *Prev2BufX,        /* Preview coords to Buffer coords */
  186.                     *Prev2BufY,
  187.                     *Buf2PrevX,        /* Buffer coords to Preview coords */
  188.                     *Buf2PrevY,
  189.                     *TableX,           /* Incremental offsets to convert */
  190.                     *TableY;           /*    from preview to buffer coords */
  191.    long              PrevSizeX,        /* Size of preview->buffer tables */
  192.                      PrevSizeY,
  193.                      BufSizeX,         /* Size of buffer->preview tables */
  194.                      BufSizeY;
  195.  
  196.    /*
  197.     * Blend Alpha channel for use with brushes and feathering....
  198.     */
  199.    UBYTE            *BlendPlane;       /* 8-bit blend plane for feathering */
  200.    UBYTE             FeatherAmt;       /* Blend plane feather amount..
  201.                                           used to keep from re-calculating
  202.                                           the same feather amount twice. */
  203.  
  204.    UBYTE             ExtFlags;         /* More flags */
  205.    UBYTE             RegionGadget;     /* Region gadget setting for this buffer
  206.                                           (PRIVATE) */
  207.    UBYTE             pad2;
  208.  
  209.    /*
  210.     * These are used by Loaders to store what kind of file the buffer
  211.     * was before it was loaded.  It stores an Amiga ViewModes.
  212.     * These are not currently used for anything.
  213.     */
  214.    ULONG             OriginalModes;    /* ViewModes before turned into 24-bit */
  215.    ULONG             OriginalDepth;    /* Depth of image before 24-bit */
  216.  
  217.    /*
  218.     * ImageFX now uses the UserData fields internally (sorry).
  219.     *
  220.     * UserData1 is used to store MAGIC information if ExtFlags & XBUFF_EXTERNAL.
  221.     * UserData2 is used in conjunction with undo buffers.
  222.     *
  223.     */
  224.    ULONG             UserData1,        /* Miscellaneous */
  225.                      UserData2;
  226.  
  227.    char              ANNO[96];         /* ANNO chunk - currently unused */
  228.  
  229.    short             ViewLeft,         /* Preview containing box */
  230.                      ViewTop,
  231.                      ViewWidth,
  232.                      ViewHeight;
  233.  
  234.    UWORD             RowsPerPage;      /* Scanlines per VMEM page */
  235.    UWORD             pad3;
  236.  
  237.    long              Reserved[3];      /* Reserved for future expansion */
  238. };
  239.  
  240.  
  241. /*
  242.  * Flag bits:
  243.  */
  244. #define BUFF_DISK    0x01              /* Buffer maintained on disk */
  245. #define BUFF_MOD     0x02              /* Buffer is modified */
  246. #define BUFF_BRUSH   0x04              /* This buffer is a brush */
  247. #define BUFF_UNDO    0x08              /* This is an undo buffer */
  248. #define BUFF_COPY    0x10              /* Private! */
  249. #define BUFF_PEN     0x20              /* This brush is really a pen */
  250.  
  251. #define BUFF_FORCEDISK 0x40            /* (internal use only) */
  252. #define BUFF_NOVMEM  0x80              /* Passed to AllocBuffer disallows virtual memory */
  253.  
  254. /*
  255.  * ExtFlag bits:
  256.  */
  257. #define XBUFF_EXTERNAL     0x01        /* This buffer has been IMPORT'ed or is MAGIC */
  258. #define XBUFF_OUTSTANDING  0x02        /* Outstanding locked vmem page */
  259. #define XBUFF_PRIVATE      0x80        /* DO NOT TOUCH! */
  260.  
  261. /* these are longwords for a reason!  so we can use them directly with Ged */
  262. struct SepInfo {
  263.    LONG     UCR,
  264.             GCR,
  265.             Magenta,
  266.             Yellow;
  267.    LONG     Type;
  268.    LONG     Plane;
  269.    LONG     Depth;
  270.    LONG     CMAP;
  271. };
  272.  
  273. struct SepBuf {
  274.    UBYTE   *Planes[32];
  275.    ULONG    PlaneSize;
  276.    UWORD    Width, Height;
  277.    UBYTE    Depth;
  278.    UBYTE    Bits;
  279.    UBYTE    Plane;
  280.    UBYTE    Flags;
  281.    UWORD    MapSize;
  282.    UBYTE   *ColorMap[4];
  283.    WORD     AspectX, AspectY;
  284.    WORD     DPIX, DPIY;
  285. };
  286.  
  287. /* Type of separation: */
  288. #define SEP_CMYK     (0)
  289. #define SEP_CMY      (1)
  290. #define SEP_RGB      (2)
  291.  
  292. /* Output colormap: */
  293. #define SEP_GREY     (0)
  294. #define SEP_COLOR    (1)
  295.  
  296. /* Depth: */
  297. #define SEP_24BIT    (0)
  298. #define SEP_12BIT    (1)
  299.  
  300. /* Flags: */
  301. #define SEP_QUIET    (0x01)         /* No edit window */
  302. #define SEP_1PLANE   (0x02)         /* Only output 1 plane */
  303. #define SEP_CHUNKY   (0x04)         /* Output chunky planes instead of bitplanes */
  304.  
  305.  
  306. #define SCAN_BUF_H
  307. #endif
  308.